<script setup lang="ts">
//右边的内容 - 页面判断
import { ref, watchEffect } from "vue";

import Combine from "@/components/home/right/combine.vue";
import Absent from "@/components/page/404.vue";
import Search from "@/components/page/search.vue";
import Category from "@/components/page/category.vue";
import Tag from "@/components/page/tag.vue";

import { Single } from "@/store/interface";
import { dataLocal } from "@/store/store.ts";

//存储返回值
const dataSum = ref();

//若路由ID变化，则获取值
watchEffect(async () => {
  dataSum.value = dataLocal.single as Single;
});
//获取页面类型
const type = dataLocal.type.page_type;
</script>
<template>
  <template v-if="type === 'search'">
    <!--搜索页-->
    <Search />
  </template>
  <template v-else-if="type === '404'">
    <!--404页-->
    <Absent />
  </template>
  <template v-else-if="type === 'category'">
    <!--分类页-->
    <Category />
  </template>
  <template v-else-if="type === 'tag'">
    <!--分类页-->
    <Tag />
  </template>

  <template v-else>
    <Combine :data="dataSum" />
  </template>
</template>
<style scoped lang="less"></style>
